package pe.gob.sunarp.entidad;

import java.io.Serializable;
import javax.persistence.*;

/**
 * The primary key class for the EX_TRANSMISION database table.
 * 
 */
@Embeddable
public class ExTransmisionPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;
	private String regPubId;
	private String oficRegId;
	private long txRefnum;
	private String sistemaId;

    public ExTransmisionPK() {
    }

	@Column(name="REG_PUB_ID", unique=true, nullable=false, length=2)
	public String getRegPubId() {
		return this.regPubId;
	}
	public void setRegPubId(String regPubId) {
		this.regPubId = regPubId;
	}

	@Column(name="OFIC_REG_ID", unique=true, nullable=false, length=2)
	public String getOficRegId() {
		return this.oficRegId;
	}
	public void setOficRegId(String oficRegId) {
		this.oficRegId = oficRegId;
	}

	@Column(name="TX_REFNUM", unique=true, nullable=false)
	public long getTxRefnum() {
		return this.txRefnum;
	}
	public void setTxRefnum(long txRefnum) {
		this.txRefnum = txRefnum;
	}

	@Column(name="SISTEMA_ID", unique=true, nullable=false, length=3)
	public String getSistemaId() {
		return this.sistemaId;
	}
	public void setSistemaId(String sistemaId) {
		this.sistemaId = sistemaId;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof ExTransmisionPK)) {
			return false;
		}
		ExTransmisionPK castOther = (ExTransmisionPK)other;
		return 
			this.regPubId.equals(castOther.regPubId)
			&& this.oficRegId.equals(castOther.oficRegId)
			&& (this.txRefnum == castOther.txRefnum)
			&& this.sistemaId.equals(castOther.sistemaId);

    }
    
	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + this.regPubId.hashCode();
		hash = hash * prime + this.oficRegId.hashCode();
		hash = hash * prime + ((int) (this.txRefnum ^ (this.txRefnum >>> 32)));
		hash = hash * prime + this.sistemaId.hashCode();
		
		return hash;
    }
}